package com.xyz.websocketclientdemo.controller;

import com.xyz.websocketclientdemo.client.IWebSocketClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Zhang Yu
 * @description: TODO
 * @date 2024/4/24 14:25
 */
@RestController
@RequestMapping("/websocket")
public class IndexController {


    @Autowired
    private IWebSocketClient webSocketClient;


    @GetMapping("/sendMessage")
    public String sendMessage(String message){
        webSocketClient.groupSending(message);
        return message;
    }

    @GetMapping("/sendMessageStr")
    public String sendMessageStr(String message){
        webSocketClient.groupSendingStr(message);
        return message;
    }


    @GetMapping("/test")
    public String test(String message){
        return message;
    }
}
